package com.xbs.service.selfdriving;

import java.sql.Date;
import java.util.List;

import com.xbs.dao.selfdriving.selfDrivingOrderAdmin;
import com.xbs.entity.CarEntity;
import com.xbs.entity.CommonOrderEntity;
import com.xbs.entity.DetailsAdminEntity;
import com.xbs.entity.PagesEntity;
import com.xbs.entity.selfOrderAdminEntity;

public class selfDrivingServiceAdmin {
	private selfDrivingOrderAdmin sdoa;
	
	public selfDrivingServiceAdmin() {
		sdoa = new selfDrivingOrderAdmin();
	}
	
	/**
	 * 1.默认查询当天生成的订单(分页查询)
	 * @param fromdate
	 * @param todate
	 * @return
	 */
	public PagesEntity<selfOrderAdminEntity> selAllco(String fromdate,String todate,String tel,int currpage,int pagesize){
		//计算起始记录数
		int curr = (currpage-1)*pagesize;
		//获取分页数据
		List<selfOrderAdminEntity> soae = sdoa.selALLco(fromdate, todate, tel, curr, pagesize);
		//获取总记录数
		int total = sdoa.selOrderAdminEntityTotal(fromdate, todate, tel);
		
		return new PagesEntity<>(currpage, pagesize, total, soae);
	}
	
	/**
	 * 2.获取总记录数
	 * @param fromdate
	 * @param todate
	 * @param tel
	 * @return
	 */
	public int selOrderAdminEntityTotal(String fromdate,String todate,String tel){
		return sdoa.selOrderAdminEntityTotal(fromdate, todate, tel);
	}
	
	/**
	 * 3.根据订单编号修改订单状态
	 * @param id
	 */
	public void cancelOrder(String id,String status){
		sdoa.cancelOrder(id,status);
	}
	
	/**
	 * 4.根据订单编号，更新实收金额
	 * @param id
	 * @param money
	 */
	public void upFactMoney(String id,Double money){
		sdoa.upFactMoney(id, money);
	}
	
	/**
	 * 5.根据订单编号，更新实付金额和实收金额
	 * @param id
	 * @param money
	 * @return
	 */
	public void upMoney(String id,Double money){
		sdoa.upMoney(id, money);
	}
	
	/**
	 * 6.根据订单编号，修改订单支付时间
	 * @param id
	 * @param time
	 * @return
	 */
	public void upPayTime(String id,String time){
		sdoa.upPayTime(id, time);
	}
	
	/**
	 * 7.根据订单编号，修改订单取消时间
	 * @param id
	 * @param time
	 * @return
	 */
	public void upCancelTime(String id,String time){
		sdoa.upCancelTime(id, time);
	}
	
	/**
	 * 8.根据订单编号，更新用户所驾驶的车牌号
	 * @param id
	 * @param carnum
	 * @return
	 */
	public void upCarId(String id,String carnum){
		sdoa.upCarId(id, carnum);
	}
	
	/**
	 * 9.根据订单编号，修改订单完成时间
	 * @param id
	 * @param time
	 * @return
	 */
	public void upFinishTime(String id,String time){
		sdoa.upFinishTime(id, time);
	}
	
	/**
	 * 10.根据订单编号，更新备注
	 * @param id
	 * @param carnum
	 * @return
	 */
	public void upRemark(String id,String remark){
		sdoa.upRemark(id, remark);
	}
	
	/**
	 * 11.更新订单金额表中的车辆破损费
	 * @param id
	 * @param money
	 * @return
	 */
	public void upDamageMoney(String id,Double money){
		sdoa.upDamageMoney(id, money);
	}
	
	/**
	 * 12.更新订单表中的客户赔偿金额（车辆破损费）
	 * @param id
	 * @param money
	 * @return
	 */
	public void upCompensation(String id,Double money){
		sdoa.upCompensation(id, money);
	}
	
	/**
	 * 13.查看详情界面显示内容(上门取还)
	 * @param id
	 * @return
	 */
	public DetailsAdminEntity selDetail(String id){
		return sdoa.selDetail(id);
	}
	
	/**
	 * 14.查看详情界面显示内容(到店取还(包含异店还车))
	 * @param id
	 * @return
	 */
	public DetailsAdminEntity selDetailStore(String id){
		return sdoa.selDetailStore(id);
	}
	
	/**
	 * 15.判断送车方式
	 * @param id
	 * @return
	 */
	public String getStatus(String id){
		return sdoa.getStatus(id);
	}
	/**
	 * 16.更新应退金额
	 * @param id
	 * @param money
	 * @return
	 */
	public void upReturnMoney(String id,Double money){
		sdoa.upReturnMoney(id, money);
	}
	
	/**
	 * 17.根据订单编号查询（是否为异地还车）
	 * @param order
	 * @return
	 */
	
	public CommonOrderEntity selAddress(String order){
		return sdoa.selAddress(order);
	}
	
	/**
	 * 18.将异地还车的车牌号，初始门店，还车门店写入顺风车
	 * @param che
	 * @param fromnum
	 * @param tonum
	 * @return
	 */
	public void insHitch(String che,int fromnum,int tonum,String status){
		sdoa.insHitch(che, fromnum, tonum,status);
	}
	
	/**
	 * 19.根据订单编号获取可租的具体车辆车牌号
	 * @param order
	 * @return
	 */
	public List<CarEntity> selCarId(String order){
		return sdoa.selCarId(order);
	}
	

	/**
	 * 20.根据车牌号，修改车的状态
	 * @param carnum
	 * @return
	 */
	public void upCarNum(String carnum,int status){
		sdoa.upCarNum(carnum,status);
	}
	
	/**
	 * 21.查询该订单的车牌号
	 * @param num
	 * @return
	 */
	public String selCarNum(String num){
		return sdoa.selCarNum(num);
	}
}
